﻿@model AdventureWorks.Entities.Address

@{
	ViewBag.Title = String.Format("Address from: {0}", Model.Customers.Single().FirstName);
}

<h2>
Address Of: @Html.ActionLink(Model.Customers.Single().FullName, "Details", "Customer", new { id = Model.Customers.Single().ID }, null)
</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Address</legend>

        @Html.HiddenFor(model => model.ID)

        <div class="editor-label">
            @Html.LabelFor(model => model.AddressLine1)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.AddressLine1)
            @Html.ValidationMessageFor(model => model.AddressLine1)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.AddressLine2)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.AddressLine2)
            @Html.ValidationMessageFor(model => model.AddressLine2)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.City)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.City)
            @Html.ValidationMessageFor(model => model.City)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.StateProvince)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.StateProvince)
            @Html.ValidationMessageFor(model => model.StateProvince)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CountryRegion)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.CountryRegion)
            @Html.ValidationMessageFor(model => model.CountryRegion)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.PostalCode)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.PostalCode)
            @Html.ValidationMessageFor(model => model.PostalCode)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.ModifiedDate)
        </div>
        <div class="editor-field">
            @Html.DisplayFor(model => model.ModifiedDate)
        </div>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    <a href="JavaScript:void(0);" onclick="JavaScript:history.back()">Back</a>
</div>
